<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Class template polymorphic_bin</title>
<link rel="stylesheet" href="../../../../../../../doc/src/boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
<link rel="home" href="../../../index.html" title="Chapter 1. Boost.Histogram">
<link rel="up" href="../../../histogram/reference.html#header.boost.histogram.axis.polymorphic_bin_hpp" title="Header &lt;boost/histogram/axis/polymorphic_bin.hpp&gt;">
<link rel="prev" href="option/underflow.html" title="Global underflow">
<link rel="next" href="transform/id.html" title="Struct id">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table cellpadding="2" width="100%"><tr>
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../../boost.png"></td>
<td align="center"><a href="../../../../../../../index.html">Home</a></td>
<td align="center"><a href="../../../../../../libraries.htm">Libraries</a></td>
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
<td align="center"><a href="../../../../../../../more/index.htm">More</a></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="option/underflow.html"><img src="../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../../histogram/reference.html#header.boost.histogram.axis.polymorphic_bin_hpp"><img src="../../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="transform/id.html"><img src="../../../../../../../doc/src/images/next.png" alt="Next"></a>
</div>
<div class="refentry">
<a name="boost.histogram.axis.polymorphic_bin"></a><div class="titlepage"></div>
<div class="refnamediv">
<h2><span class="refentrytitle">Class template polymorphic_bin</span></h2>
<p>boost::histogram::axis::polymorphic_bin — Holds the bin data of an <a class="link" href="variant.html" title="Class template variant">axis::variant</a>.</p>
</div>
<h2 xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv-title">Synopsis</h2>
<div xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv"><pre class="synopsis"><span class="comment">// In header: &lt;<a class="link" href="../../../histogram/reference.html#header.boost.histogram.axis.polymorphic_bin_hpp" title="Header &lt;boost/histogram/axis/polymorphic_bin.hpp&gt;">boost/histogram/axis/polymorphic_bin.hpp</a>&gt;

</span><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> RealType<span class="special">&gt;</span> 
<span class="keyword">class</span> <a class="link" href="polymorphic_bin.html" title="Class template polymorphic_bin">polymorphic_bin</a> <span class="special">{</span>
<span class="keyword">public</span><span class="special">:</span>
  <span class="comment">// <a class="link" href="polymorphic_bin.html#boost.histogram.axis.polymorphic_binconstruct-copy-destruct">construct/copy/destruct</a></span>
  <a class="link" href="polymorphic_bin.html#idm45537378059232-bb"><span class="identifier">polymorphic_bin</span></a><span class="special">(</span><span class="identifier">value_type</span><span class="special">,</span> <span class="identifier">value_type</span><span class="special">)</span><span class="special">;</span>

  <span class="comment">// <a class="link" href="polymorphic_bin.html#idm45537378072048-bb">public member functions</a></span>
  <a class="link" href="polymorphic_bin.html#idm45537378071488-bb"><span class="keyword">operator</span> <span class="keyword">const</span> <span class="identifier">value_type</span> <span class="special">&amp;</span></a><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span> <span class="keyword">noexcept</span><span class="special">;</span>
  <span class="identifier">value_type</span> <a class="link" href="polymorphic_bin.html#idm45537378070192-bb"><span class="identifier">lower</span></a><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span> <span class="keyword">noexcept</span><span class="special">;</span>
  <span class="identifier">value_type</span> <a class="link" href="polymorphic_bin.html#idm45537378068928-bb"><span class="identifier">upper</span></a><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span> <span class="keyword">noexcept</span><span class="special">;</span>
  <span class="identifier">value_type</span> <a class="link" href="polymorphic_bin.html#idm45537378067664-bb"><span class="identifier">center</span></a><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span> <span class="keyword">noexcept</span><span class="special">;</span>
  <span class="identifier">value_type</span> <a class="link" href="polymorphic_bin.html#idm45537378066416-bb"><span class="identifier">width</span></a><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span> <span class="keyword">noexcept</span><span class="special">;</span>
  <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> BinType<span class="special">&gt;</span> <span class="keyword">bool</span> <a class="link" href="polymorphic_bin.html#idm45537378065168-bb"><span class="keyword">operator</span><span class="special">==</span></a><span class="special">(</span><span class="keyword">const</span> <span class="identifier">BinType</span> <span class="special">&amp;</span><span class="special">)</span> <span class="keyword">const</span> <span class="keyword">noexcept</span><span class="special">;</span>
  <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> BinType<span class="special">&gt;</span> <span class="keyword">bool</span> <a class="link" href="polymorphic_bin.html#idm45537378062832-bb"><span class="keyword">operator</span><span class="special">!=</span></a><span class="special">(</span><span class="keyword">const</span> <span class="identifier">BinType</span> <span class="special">&amp;</span><span class="special">)</span> <span class="keyword">const</span> <span class="keyword">noexcept</span><span class="special">;</span>
  <span class="keyword">bool</span> <a class="link" href="polymorphic_bin.html#idm45537378060496-bb"><span class="identifier">is_discrete</span></a><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span> <span class="keyword">noexcept</span><span class="special">;</span>
<span class="special">}</span><span class="special">;</span></pre></div>
<div class="refsect1">
<a name="idm46096937077552"></a><h2>Description</h2>
<p>The interface is a superset of the <a class="link" href="interval_view.html" title="Class template interval_view">axis::interval_view</a> class. In addition, the object is implicitly convertible to the value type, returning the equivalent of a call to lower(). For discrete axes, lower() == upper(), and width() returns zero.</p>
<p>This is not a view like <a class="link" href="interval_view.html" title="Class template interval_view">axis::interval_view</a> for two reasons.</p>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem"><p>Sequential calls to lower() and upper() would have to each loop through the variant types. This is likely to be slower than filling all the data in one loop.</p></li>
<li class="listitem"><p><a class="link" href="polymorphic_bin.html" title="Class template polymorphic_bin">polymorphic_bin</a> may be created from a temporary instance of<a class="link" href="variant.html" title="Class template variant">axis::variant</a>, like in the call histogram::axis(0). Storing a reference to the axis would result in a dangling reference. Rather than specialing the code to handle this, it seems easier to just use a value instead of a view.</p></li>
</ul></div>
<div class="refsect2">
<a name="idm46096937071552"></a><h3>
<a name="boost.histogram.axis.polymorphic_binconstruct-copy-destruct"></a><code class="computeroutput">polymorphic_bin</code> 
        public
       construct/copy/destruct</h3>
<div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem"><pre class="literallayout"><a name="idm45537378059232-bb"></a><span class="identifier">polymorphic_bin</span><span class="special">(</span><span class="identifier">value_type</span> lower<span class="special">,</span> <span class="identifier">value_type</span> upper<span class="special">)</span><span class="special">;</span></pre></li></ol></div>
</div>
<div class="refsect2">
<a name="idm46096937063552"></a><h3>
<a name="idm45537378072048-bb"></a><code class="computeroutput">polymorphic_bin</code> public member functions</h3>
<div class="orderedlist"><ol class="orderedlist" type="1">
<li class="listitem">
<pre class="literallayout"><a name="idm45537378071488-bb"></a><span class="keyword">operator</span> <span class="keyword">const</span> <span class="identifier">value_type</span> <span class="special">&amp;</span><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span> <span class="keyword">noexcept</span><span class="special">;</span></pre>Implicitly convert to bin value (for axis with discrete values). </li>
<li class="listitem">
<pre class="literallayout"><span class="identifier">value_type</span> <a name="idm45537378070192-bb"></a><span class="identifier">lower</span><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span> <span class="keyword">noexcept</span><span class="special">;</span></pre>Return lower edge of bin. </li>
<li class="listitem">
<pre class="literallayout"><span class="identifier">value_type</span> <a name="idm45537378068928-bb"></a><span class="identifier">upper</span><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span> <span class="keyword">noexcept</span><span class="special">;</span></pre>Return upper edge of bin. </li>
<li class="listitem">
<pre class="literallayout"><span class="identifier">value_type</span> <a name="idm45537378067664-bb"></a><span class="identifier">center</span><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span> <span class="keyword">noexcept</span><span class="special">;</span></pre>Return center of bin. </li>
<li class="listitem">
<pre class="literallayout"><span class="identifier">value_type</span> <a name="idm45537378066416-bb"></a><span class="identifier">width</span><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span> <span class="keyword">noexcept</span><span class="special">;</span></pre>Return width of bin. </li>
<li class="listitem"><pre class="literallayout"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> BinType<span class="special">&gt;</span> <span class="keyword">bool</span> <a name="idm45537378065168-bb"></a><span class="keyword">operator</span><span class="special">==</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">BinType</span> <span class="special">&amp;</span> rhs<span class="special">)</span> <span class="keyword">const</span> <span class="keyword">noexcept</span><span class="special">;</span></pre></li>
<li class="listitem"><pre class="literallayout"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> BinType<span class="special">&gt;</span> <span class="keyword">bool</span> <a name="idm45537378062832-bb"></a><span class="keyword">operator</span><span class="special">!=</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">BinType</span> <span class="special">&amp;</span> rhs<span class="special">)</span> <span class="keyword">const</span> <span class="keyword">noexcept</span><span class="special">;</span></pre></li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">bool</span> <a name="idm45537378060496-bb"></a><span class="identifier">is_discrete</span><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span> <span class="keyword">noexcept</span><span class="special">;</span></pre>Return true if bin is discrete. </li>
</ol></div>
</div>
</div>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"></td>
<td align="right"><div class="copyright-footer">Copyright © 2016-2019 Hans
      Dembinski<p>
        Distributed under the Boost Software License, Version 1.0. (See accompanying
        file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
      </p>
</div></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="option/underflow.html"><img src="../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../../histogram/reference.html#header.boost.histogram.axis.polymorphic_bin_hpp"><img src="../../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="transform/id.html"><img src="../../../../../../../doc/src/images/next.png" alt="Next"></a>
</div>
</body>
</html>
